#pragma once
#include "KVDatabase.h"
#include "ThreadSafeKVDB.h"
#include "StripedLockingKVDB.h"
// #include "SkipList.h"

enum class DatabaseType {
    SkipList,
    HashMap,
    StripedLockingKVDB
};

template <typename Key, typename Value>
class DatabaseFactory {
public:
    static std::unique_ptr<KVDatabase<Key, Value>> create(
        DatabaseType type,
        int max_level = 8) {
        switch (type) {
        case DatabaseType::HashMap:
            return std::make_unique<ThreadSafeKVDB<Key, Value>>();
        case DatabaseType::StripedLockingKVDB:
            return std::make_unique<StripedLockingKVDB<Key, Value>>();
        case DatabaseType::SkipList:
            // return std::make_unique<SkipList<Key, Value>>(max_level);
        default:
            throw std::invalid_argument("Unknown database type");
        }
    }
};
